﻿namespace ExamV5.WAPPage
{
    using ExamV5;
    using System;
    using System.Configuration;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;

    public class FrmShowSW : Page
    {
        protected HtmlForm form1;
        protected HtmlHead Head1;
        private HttpCookie httpCookie_0 = null;
        private HttpCookie httpCookie_1 = null;
        private HttpCookie httpCookie_2 = null;
        private HttpCookie httpCookie_3 = null;
        private PublicFun publicFun_0 = new PublicFun();
        protected string strFileName = "";

        protected void Page_Load(object sender, EventArgs e)
        {
            this.httpCookie_0 = new HttpCookie("ExamUserCode");
            this.httpCookie_0 = base.Request.Cookies["ExamUserCode"];
            this.httpCookie_1 = new HttpCookie("ExamUserName");
            this.httpCookie_1 = base.Request.Cookies["ExamUserName"];
            this.httpCookie_2 = new HttpCookie("ExamUserLevel");
            this.httpCookie_2 = base.Request.Cookies["ExamUserLevel"];
            this.httpCookie_3 = new HttpCookie("ExamDeptID");
            this.httpCookie_3 = base.Request.Cookies["ExamDeptID"];
            if ((this.httpCookie_0 != null) ? !(this.httpCookie_0.Value == "") : false)
            {
                base.Response.Cache.SetCacheability(HttpCacheability.NoCache);
                base.Response.Cache.SetNoStore();
                this.httpCookie_0.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_0.Value));
                this.httpCookie_1.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_1.Value));
                this.httpCookie_2.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_2.Value));
                this.httpCookie_3.Value = this.publicFun_0.CheckString(base.Server.UrlDecode(this.httpCookie_3.Value));
                base.Title = ConfigurationManager.ConnectionStrings["ProTitle"].ConnectionString + "---查看电子教材";
                if (!base.IsPostBack)
                {
                    this.strFileName = base.Server.HtmlDecode(base.Request["strName"]);
                    string str = FormsAuthentication.HashPasswordForStoringInConfigFile(this.httpCookie_0.Value, "MD5").Trim();
                    if (str.Length > 20)
                    {
                        str = str.Substring(0, 20);
                    }
                    int num = Convert.ToInt16(this.strFileName.Substring(0, 1));
                    string str2 = this.strFileName.Substring(1, 7);
                    string str4 = this.strFileName.Substring(8, 1);
                    str2 = str2 + this.strFileName.Substring(9, 8);
                    str4 = str4 + this.strFileName.Substring(0x11, 1);
                    string str3 = this.strFileName.Substring(0x12, 3);
                    if (num <= 2)
                    {
                        str2 = str2 + this.strFileName.Substring(0x15, 5);
                        str3 = str3 + this.strFileName.Substring(0x1a);
                    }
                    else
                    {
                        str4 = str4 + this.strFileName.Substring(0x15, num - 2);
                        str2 = str2 + this.strFileName.Substring((0x15 + num) - 2, 5);
                        str3 = str3 + this.strFileName.Substring(((0x15 + num) - 2) + 5);
                    }
                    if (str.ToLower() == str2.ToLower())
                    {
                        this.strFileName = str3 + "." + str4;
                    }
                    else
                    {
                        this.strFileName = "无效盗用链接";
                    }
                }
            }
            else
            {
                base.Response.Write("<script language=javascript>top.location.href='../Index.htm';self.close();</script>");
            }
        }
    }
}

